// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   QuranCanvas.java
package canvas;

import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;

// Referenced classes of package mquran:
//            Drawer, MenuItem, MenuBarQuran, ScrollBar, 
//            OnlineSearchCanvas, MessageBox, SUtils, Loader, 
//            Quran, SearchCanvas
public class QuranCanvas extends Canvas
        implements CommandListener {

    public QuranCanvas(Display display, Quran midletQuran) {
        setFullScreenMode(true);
        paint_flag = 3;
        form_help = null;
        column = 2;
        translation_type = 0;
        textfield = null;
        max_buffer_size = 55000;
        cur_index = 1;
        isnotenoughmemory = false;
        this.display = display;
        midlet = midletQuran;
        drawer = new Drawer(this);
        downloading = false;
        classobj = getClass();
        cur_surah = null;
        show_surah = 0;
        num_ayat = 0;
        buffer_len = 0;
        cur_page = 1;
        selected_surah = 1;
        dirty = false;
        is_in_index = true;
        lines = 1;
        lines2 = 1;
        top = 12;
        margin_top = 25;
        cur_lines_index = 1;
//        translation_type = loadTranslationSetting();
        try {
            buffer = new byte[max_buffer_size];
        } catch (Exception exception) {
            isnotenoughmemory = true;
        }
    }

    boolean isnotenoughmemory;
    boolean downloading;
    private SearchCanvas searchCanvas;
    MenuBarQuran menuIndex;
    MenuBarQuran menuSurah;
    MenuBarQuran menuBar;
    static MenuItem menuPlay;
    static MenuItem menuStop;
//    Image img_basmalah;
    int pilihSurat = 0;
    int pilih = 0;
    
    public final void init() {
        cur_lines_index = 1;
        cur_page = 1;
        selected_surah = 1;
        loadGraphic();

        /*
        Vector v = new Vector();
        v.addElement(new MenuItem("Buka", 0, null));
        //v.addElement(new MenuItem("Buka Bookmark", 0, null));
        v.addElement(new MenuItem("Tentang", 0, null));
        v.addElement(new MenuItem("Keluar", 0, null));
        menuIndex = new MenuBarQuran(midlet, v, 1);
        v = new Vector();
        v.addElement(new MenuItem("Index Surah", 0, null));
        //v.addElement(new MenuItem("Simpan Bookmark", 0, null));
        v.addElement(new MenuItem("Ke Ayat", 0, null));
        v.addElement(new MenuItem("Awal", 0, null));
        v.addElement(new MenuItem("Akhir", 0, null));
        menuSurah = new MenuBarQuran(midlet, v, 1);
        menuBar = menuIndex;
         */
    }

    public void showSearch() {
        form_search = new Form("Cari");
        textField = new TextField("Cari :", "", 16, 0);
        form_search.append(textField);
        form_search.addCommand(cmd_ok_search);
        form_search.addCommand(cmd_cancel);
        form_search.setCommandListener(this);
        display.setCurrent(form_search);
    }

    private final void loadGraphic() {
        font = Font.getFont(0, 0, 8);
        fontBold = Font.getFont(0, 1, 0);
        fontbold_height = fontBold.getHeight();
        width = getWidth();
        height = getHeight();
        scrollbar = new ScrollBar(width, height - fontbold_height);
        bar_size = scrollbar.getBarSize() + 2;
//        try
//        {
//            img_selector = Image.createImage("/images/selector.png");
//            img_basmalah = Image.createImage("/images/bis.png");
//            img_idx = Image.createImage("/images/bg.jpg");
//        }
//        catch(IOException ioexception) { }
        String surahTitle = "114 Al-Mutaffiffin 114 Al-Mumtahina";
        int surahTitleWidth = font.stringWidth(surahTitle) + 5;
        if (width < 176 || surahTitleWidth > width - bar_size) {
            column = 1;
        }
        font_height = font.getHeight();
        top = font_height + 3;
        for (int j1 = 0; j1 < 127; j1++) {
            CHAR_WIDTH[j1] = (short) font.charWidth((char) j1);
        }

        width_286 = font.stringWidth("286");
        left_286 = width_286 + (CHAR_WIDTH[65] >> 1);
        center_height = height - top - margin_top - fontbold_height;
        center_top = margin_top + 1;
        center2_height = height - fontbold_height * 2 - fontbold_height;
        headerHeight = fontbold_height + 20;
        lines = center_height / font_height;
        if (center_height % font_height >= font_height - 1) {
            lines++;
        }
        lines2 = center2_height / font_height;
        if (center2_height % font_height >= font_height - 1) {
            lines2++;
        }
        H = width_286;
        x_column_number1 = 5;
        x_column_1 = x_column_number1 + H + 2;
        x_column_number2 = ((width >> 1) + (x_column_1 >> 1)) - 2 - bar_size;
        x_column_2 = x_column_number2 + H + 2;
        if (column == 1) {
            num_lines_index = SURAH.length / lines2;
            if (num_lines_index * lines2 < SURAH.length) {
                num_lines_index++;
            }
        } else {
            num_lines_index = (SURAH.length >> 1) / lines2;
            if (num_lines_index * lines2 < SURAH.length / 2) {
                num_lines_index++;
            }
        }
        xSelector = 0;
        ySelector = (headerHeight + (font_height >> 1)) - 6;
        initxy();
        for (int k1 = 0; k1 < 95; k1++) {
            ARABIC_CHARACTERS[k1] = createArabicChar((short) (160 + k1));
        }

        buffer_line_arabic = new byte[300];
    }

    public final void paint(Graphics g1) {
        System.out.println("pain flag ==============================" + paint_flag);
        if ((paint_flag & 1) == 1) {
            System.out.println("pain flag 1 ");
            g1.setClip(0, 0, width, height - fontbold_height);
            if (dirty && !is_in_index) {
                g1.setColor(0xffdd66);
                g1.fillRect(0, 0, width, height - fontbold_height);
                drawer.draw(g1, pilih);
                scrollbar.setNumLines(num_pages);
                scrollbar.set(cur_page);
            }
            System.out.println(is_in_index + "is_index =================");
            if (is_in_index) {
                g1.setColor(0xf4cde3);
                g1.fillRect(0, 0, width, height - fontbold_height);
//                g1.drawImage(null, g1.getClipWidth() >> 1, 0, 17);
                g1.setColor(0);
                g1.setFont(fontBold);
                int currPage = (cur_lines_index - 1) * (lines2 << 1);
                if (column == 1) {
                    currPage = (cur_lines_index - 1) * lines2;
                }
                int l1 = 0;
                int k1 = currPage;
                int yStringSurah = headerHeight;
                for (int i = currPage; i < currPage + lines2 && l1 <= lines2 << 1; i++) {
                    try {
                        g1.setColor(0);
                        g1.setFont(font);
                        g1.drawString(SURAH[k1], x_column_1, yStringSurah, 0);
                        if (column == 2) {
                            g1.drawString(SURAH[k1 + 1], x_column_2, yStringSurah, 0);
                        }
                        g1.setColor(0);
                        g1.setFont(font);
                        g1.drawString(String.valueOf(k1 + 1), x_column_number1, yStringSurah, 0);
                        if (column == 2) {
                            g1.drawString(String.valueOf(k1 + 2), x_column_number2, yStringSurah, 0);
                        }
                    } catch (Exception exception1) {
                        break;
                    }
                    k1 += column;
                    l1 += column;
                    yStringSurah += font_height;
                }

                g1.setColor(0);
                g1.setFont(font);
                if (ySelector > yStringSurah - font_height) {
                    ySelector = ((yStringSurah - font_height) + (font_height >> 1)) - 3;
                }
//                g1.drawImage(img_selector, xSelector, ySelector, 20);
                scrollbar.setNumLines(num_lines_index);
                scrollbar.set(cur_lines_index);
            }
            scrollbar.draw(g1);
        }
        if ((paint_flag & 2) == 2) {
           System.out.println("pain flag 2 ");
            g1.setFont(font);
            g1.setColor(0xffdd66);
            int y2 = getHeight() - fontbold_height;
            g1.setClip(0, y2, getWidth(), fontbold_height);
            SUtils.drawColorDeg(g1, 0xffe56b, 0xffffff, 0, y2 + 1, getWidth(), fontbold_height, true);
            if (bar_width > 0) {
                g1.setColor(0xa39b84);
                g1.fillRect(1, y2 + 3, ((getWidth() - 2) * bar_progress) / bar_width, font_height - 3);
            }
            g1.setColor(0xffffff);
            g1.drawLine(1, y2, getWidth(), y2);
            y2 += 2;
            if (menuBar != null && menuBar.shown) {
                g1.setColor(0);
               
                g1.drawString("Kembali", getWidth() - 2, y2, 24);
                System.out.println("menu bar");
            } else if (messageBox != null) {
                if ((messageBox.type & 1) == 1) {
                    g1.setColor(0x808080);
                    g1.drawString("OK", 3, y2 + 1, 20);
                    g1.setColor(0);
                    g1.drawString("OK", 2, y2, 20);
                }
            } else {
                g1.setColor(0);
                //g1.drawString("Menu", 2, y2, 20);
                if (is_in_index) {
                    g1.drawString("Keluar", getWidth() - 2, y2, 24);
                } else {
                    g1.drawString("Keluar", 50 , y2, 24);
                    g1.drawString("Kembali", getWidth() - 2, y2, 24);
                    System.out.println("bar menu");
                }
                if (!is_in_index) {
                    try {
                        int x = font.stringWidth("Menu") + 5;
//                        if(playing_stats != null)
//                        {
//                            g1.drawImage(img_selector, x, y2, 20);
//                            g1.drawString(playing_stats, img_selector.getWidth() + x + 2, y2 + 1, 20);
//                            x += img_selector.getWidth() + font.stringWidth(playing_stats) + 2;
//                        }
                        x += 10;
                    } catch (Exception e) {
                        System.err.println("File Not Found");
                    }
                }
            }
        }
        if ((paint_flag & 4) == 4) {
            System.out.println("pain flag 4 ");
            menuBar.draw(g1, getWidth(), getHeight() - fontbold_height);
            paint_flag = 0;
            return;
        }
        if ((paint_flag & 8) == 8) {
            System.out.println("pain flag 8");
            messageBox.draw(g1, getWidth(), getHeight() - fontbold_height);
        }
        paint_flag = 0;
    }

    public final void keyPressed(int key) {
        if (menuBar != null && menuBar.shown) {
            boolean isKeyMenu = menuBar.keyPressed(key);
            if (isKeyMenu) {
                if (menuBar.shown) {
                    paint_flag |= 4;
                } else {
                    paint_flag |= 3;
                }
            }
            repaint();
            return;
        }
        if (messageBox != null) {
            if ((messageBox.type & 1) == 1 && key == -6) {
                messageBox = null;
                paint_flag = 3;
                repaint();
            }
            return;
        }
        if (key >= 48 && key <= 57 || key == 42 || key == 35) {
            menuBar.shortcutPress(key);
            return;
        }
        switch (key) {
            case -5:
                if (is_in_index) {
                    Loader.getInstance(this).startLoader(0, pilih);
                }
                return;

            case -6:
//                menuBar.show();
//                paint_flag |= 6;
//                repaint();
                midlet.destroyApp(true);
                return;

            case -7:
                if (!is_in_index) {
                    midlet.showMenuUtama();
                    //gotoIndex();
                } else {
                    Quran _tmp = midlet;
                    Quran.exit();
                }
                return;
        }
        int gkey = getGameAction(key);
        switch (gkey) {
            case 3: // '\003'
            case 4: // '\004'
            default:
                break;

            case 1: // '\001'
                if (!is_in_index) {
                    if (cur_page > 1) {
                        cur_page--;
                        scrollbar.dec();
                        paint_flag |= 1;
                        repaint();
                    }
                } else {
                    if (ySelector - font_height >= (headerHeight + (font_height >> 1)) - 6) {
                        ySelector -= font_height;
                    } else {
                        ySelector = center2_height + 6 + font_height;
                        cur_lines_index--;
                        if (cur_lines_index < 1) {
                            selected_surah += 114;
                            cur_lines_index = num_lines_index;
                        }
                    }
                    selected_surah -= column;
                    scrollbar.dec();
                    paint_flag |= 1;
                    repaint();
                }
                return;

            case 6: // '\006'
                try {
                    if (!is_in_index) {
                        if (cur_page < num_pages) {
                            cur_page++;
                            scrollbar.inc();
                            paint_flag |= 1;
                            repaint();
                        }
                    } else {
                        int k1 = (lines2 << column - 1) * cur_lines_index;
                        if (k1 > 114) {
                            k1 = 114;
                        }
                        if (selected_surah + column <= k1) {
                            ySelector += font_height;
                        } else {
                            ySelector = (headerHeight + (font_height >> 1)) - 6;
                            cur_lines_index++;
                            if (cur_lines_index > num_lines_index) {
                                selected_surah -= 114;
                                cur_lines_index = 1;
                            }
                        }
                        selected_surah += column;
                        scrollbar.inc();
                        paint_flag |= 1;
                        repaint();
                    }
                    return;
                } catch (Exception exception) {
                }
                break;

            case 2: // '\002'
                if (is_in_index && column > 1 && xSelector != 0) {
                    xSelector = 0;
                    selected_surah--;
                    paint_flag |= 1;
                    repaint();
                }
                return;

            case 5: // '\005'
                if (is_in_index && column > 1 && xSelector == 0) {
//                xSelector = x_column_2 - img_selector.getWidth() - 2 - H;
                    selected_surah++;
                    paint_flag |= 1;
                    repaint();
                }
                return;
        }
    }

    void openSurah(int surat, int pilih) {
        pilihSurat = surat;
        this.pilih = pilih;
        menuBar = menuSurah;
        if (show_surah != selected_surah) {
            cur_page = 1;
        }
        dirty = true;
        if (show_surah != selected_surah) {
            loadChapter();
        }
        show_surah = selected_surah;
        is_in_index = false;
        if (surat > 0) {
            setCurAyat(1);
        }
        paint_flag = 3;
    }

    public final void keyRepeated(int keyCode) {
        int gameCode = getGameAction(keyCode);
        if (gameCode == 1 || gameCode == 6) {
            keyPressed(keyCode);
        }
    }

    public final void gotoIndex() {
        show_surah = 0;
        is_in_index = true;
        menuBar = menuIndex;
        paint_flag = 3;
        repaint();
    }

    public final void gotoStart() {
        if (is_in_index) {
            ySelector = (headerHeight + (font_height >> 1)) - 6;
            cur_lines_index = 1;
            if (selected_surah % 2 == 0) {
                selected_surah = 2;
            } else {
                selected_surah = 1;
            }
        } else {
            cur_page = 1;
            scrollbar.set(1);
        }
        paint_flag |= 1;
        repaint();
    }

    public final void gotoEnd() {
        if (is_in_index) {
            ySelector = center2_height + 6;
            cur_lines_index = num_lines_index;
            if (selected_surah % 2 == 0) {
                selected_surah = 114;
            } else {
                selected_surah = 113;
            }
        } else {
            cur_page = num_pages;
            scrollbar.set(cur_page);
        }
        paint_flag |= 1;
        repaint();
    }

    public boolean setCurAyat(int ayat) {
        int tmp_page = cur_page;
        if (num_pages == 1) {
            cur_page = 1;
        } else {
            try {
                int y = line_on_page[ayat] + 1;
                int k1 = 1;
                do {
                    if (k1 > num_pages) {
                        break;
                    }
                    if (y >= page_line_start[k1] && y <= page_line_start[k1 + 1] - 1) {
                        cur_page = k1;
                        break;
                    }
                    k1++;
                } while (true);
                if (k1 == num_pages) {
                    cur_page = k1;
                }
            } catch (Exception exception) {
                cur_page = 1;
            }
        }
        return tmp_page != cur_page;
    }

    public final void initxy() {
        try {
            xSelector = 0;
            ySelector = (headerHeight + (font_height >> 1)) - 6;
            if (selected_surah % 2 == 0 && column == 2) {
                xSelector = x_column_2 - 4 - 2 - H;
            } else {
                xSelector = 0;
            }
            cur_lines_index = (selected_surah >> column - 1) / lines2;
            if (cur_lines_index * lines2 < selected_surah / ((column + 1) - 1)) {
                cur_lines_index++;
            }
            if (cur_lines_index == 0) {
                cur_lines_index = 1;
            }
            int i1 = selected_surah - (cur_lines_index - 1) * (lines2 << column - 1);
            int j1 = 0;
            if (i1 != 0) {
                j1 = i1 >> column - 1;
                if (j1 << column - 1 < i1) {
                    j1++;
                }
            }
            ySelector += font_height * (j1 - 1);
        } catch (Exception exception) {
        }
    }

    public int getCurAyat() {
        if (cur_page == 1) {
            return 1;
        }
        short ayt = 1;
        short line = page_line_start[cur_page];
        if (ayat_line[line] != ayat_line[line - 1]) {
            ayt = ayat_line[line];
        } else {
            int j1 = line + 1;
            if (page_line_start.length >= cur_page + 1) {
                j1 = page_line_start[cur_page + 1] - 1;
            }
            for (int i1 = line + 1; i1 < j1; i1++) {
                if (ayat_line[i1] != ayat_line[i1 - 1]) {
                    return ayat_line[i1];
                }
            }

            ayt = ayat_line[line];
        }
        return ayt;
    }

    public final void verse() {
        if (!is_in_index) {
            Form form = new Form("Lompat Ayat yang dicari");
            textfield = new TextField("No Ayat :", "", 3, 2);
            form.append(textfield);
            form.addCommand(cmd_verse_ok);
            form.addCommand(cmd_cancel);
            form.setCommandListener(this);
            display.setCurrent(form);
        } else {
            showMessageBox("Ayat yang dicari tidak terdapat disurah ini", 1, 0);
        }
    }

    public void commandAction(Command command, Displayable displayable) {
        if (command == cmd_verse_ok) {
            int i1 = 0;
            try {
                i1 = Integer.parseInt(textfield.getString());
            } catch (Exception exception1) {
                showMessageBox("Ayat yang dicari tidak terdapat disurah ini", 1, 0);
                return;
            }
            if (i1 < 1 || i1 > num_ayat) {
                showMessageBox("Ayat yang dicari tidak terdapat disurah ini", 1, 0);
                return;
            }
            try {
                if (num_pages == 1) {
                    cur_page = 1;
                } else {
                    short word0 = line_on_page[i1];
                    int j1 = 0;
                    j1 = 0;
                    do {
                        if (j1 > num_pages) {
                            break;
                        }
                        if (word0 >= page_line_start[j1] && word0 <= page_line_start[j1 + 1] - 1) {
                            cur_page = j1;
                            break;
                        }
                        if (j1 == num_pages) {
                            cur_page = j1;
                            break;
                        }
                        j1++;
                    } while (true);
                }
            } catch (Exception exception2) {
            }
            display.setCurrent(this);
        } else if (cmd_ok_search == command) {
            if (textField.getString().length() > 3) {
                //OnlineSearchCanvas searchCanvas = new OnlineSearchCanvas(this, textField.getString());
                //display.setCurrent(searchCanvas);
                //(new Thread(searchCanvas)).start();
            } else {
                showMessageBox("Minimum seeking 3 letter", 1, 0);
            }
        } else if (command == cmd_cancel) {
            midlet.showMenuUtama();
            //display.setCurrent(this);
        }
    }

    public int loadTranslationSetting() {
        /*
        RecordStore recordstore;
        byte byte0;
        recordstore = null;
        byte0 = 0;
        recordstore = RecordStore.openRecordStore("MKAQRS_record", true);
        int i1 = 1;
        do
        {
        if(i1 > recordstore.getNumRecords())
        break;
        byte abyte0[] = recordstore.getRecord(i1);
        if(abyte0[0] == 14)
        {
        byte0 = abyte0[1];
        break;
        }
        i1++;
        } while(true);
        try
        {
        if(recordstore != null)
        recordstore.closeRecordStore();
        }
        catch(Exception exception) { }
        break MISSING_BLOCK_LABEL_154;
        RecordStoreFullException e;
        e;
        e.printStackTrace();
        try
        {
        if(recordstore != null)
        recordstore.closeRecordStore();
        }
        catch(Exception exception) { }
        break MISSING_BLOCK_LABEL_154;
        exception;
        exception.printStackTrace();
        try
        {
        if(recordstore != null)
        recordstore.closeRecordStore();
        }
        catch(Exception exception) { }
        break MISSING_BLOCK_LABEL_154;
        exception;
        exception.printStackTrace();
        try
        {
        if(recordstore != null)
        recordstore.closeRecordStore();
        }
        catch(Exception exception) { }
        break MISSING_BLOCK_LABEL_154;
        Exception exception1;
        exception1;
        try
        {
        if(recordstore != null)
        recordstore.closeRecordStore();
        }
        catch(Exception exception) { }
        throw exception1;
        return byte0;
         */
        return 0;
    }

    private void setTranslation(int i1) {
        RecordStore recordstore = null;
        try {
            boolean found = false;
            byte abyte0[] = {
                14, (byte) i1
            };
            recordstore = RecordStore.openRecordStore("MKAQRS_record", true);
            if (recordstore.getNumRecords() == 0) {
                recordstore.addRecord(abyte0, 0, abyte0.length);
            } else {
                int j1 = 1;
                do {
                    if (j1 > recordstore.getNumRecords()) {
                        break;
                    }
                    byte abyte1[] = recordstore.getRecord(j1);
                    if (abyte1[0] == 14) {
                        recordstore.setRecord(j1, abyte0, 0, abyte0.length);
                        found = true;
                        break;
                    }
                    j1++;
                } while (true);
                if (!found) {
                    recordstore.addRecord(abyte0, 0, abyte0.length);
                }
            }
        } catch (Exception exception1) {
            try {
                if (recordstore != null) {
                    recordstore.closeRecordStore();
                }
            } catch (Exception exception2) {
            }
        }
    }

    public final void showHelp() {
        form_help = new Form("Bantuan");
        form_help.append("Qur'an Digital bandungsoft.net @2009");
        form_help.addCommand(cmd_cancel);
        form_help.setCommandListener(this);
        display.setCurrent(form_help);
    }

    public final void showMessageBox(String msg, int type, int bar) {
        messageBox = new MessageBox(msg, getWidth() - 10, type, bar);
        paint_flag |= 0xa;
        repaint();
    }

    public boolean loadBin(int index) {
        System.out.println("Surat ke -" + index);
        InputStream resource = null;
        buffer_len = 0;
        cur_index = (short) index;
        String file;
        //if(index == 1)
        // file = String.valueOf(selected_surah);
        //else
        // file = String.valueOf(selected_surah) + "-" + (index - 1);
        resource = classobj.getResourceAsStream("/bin/" + pilihSurat + ".bin");
        if (resource == null) {
            showMessageBox("Surah tidak ditemukan", 1, 1);
        }
        buffer_len = readResource(buffer, resource);
        return true;
    }

    public static int readResource(byte abyte0[], InputStream inputstream) {
        int total = 0;
        for (int r = 0; total < max_buffer_size && r >= 0;) {
            try {
                if (inputstream.available() <= 0) {
                    r = -1;
                } else {
                    r = inputstream.read(abyte0, total, max_buffer_size - total);
                    if (r != -1) {
                        total += r;
                    }
                }
            } catch (EOFException eofexception) {
                return total;
            } catch (Exception exception) {
                return 0;
            }
        }

        return total;
    }

    private final void loadChapter() {
        System.out.println("######### Masuk Chapter  #############");
        boolean begining = false;
        int i3 = 0;
        page = 0;
        num_pages = 1;
        int idx_surah_name_end = 0;
        num_ayat = 0;
        int surahLength = 0;
        boolean latin = false;
        int k1 = 0;
        int i2 = 1;
        int k2 = width - bar_size - CHAR_WIDTH[65];
        int sumLineHeight = center_top;
        if (selected_surah == 1 || selected_surah == 9) {
            sumLineHeight = 2;
        }
        char ac1[] = null;
        char ac2[] = null;
        try {
            if (!loadBin(1)) {
                return;
            }
        } catch (Exception exception) {
        }
        if (buffer_len == 0) {
            is_in_index = true;
            dirty = false;
            showMessageBox("Surah tidak ditemukan!", 1, 0);
            return;
        }
        int ai1[];
        try {
            ac1 = new char[k2 + 1];
            ai1 = new int[150];
        } catch (Exception exception2) {
            exception2.printStackTrace();
            showMessageBox("surah Tidak ditemukan! Memory tidak cukup.", 1, 0);
            return;
        }
        int j3 = 0;
        for (int i = 0; i < 300; i++) {
            line_on_page[i] = 0;
        }

        int line = 0;
        int lineHeight = font_height + 2;
        int part = 1;
        int charw;
        int l4;
        int i5;
        int j5;
        do {
            if (part > PART_SURAH[selected_surah - 1]) {
                break;
            }
            charw = CHAR_WIDTH[32];
            boolean arabic = false;
            for (int i = 0; i < buffer_len; i++) {
                if (part == 1 && !begining) {
                    begining = true;
                    if (i == 0 && buffer[i] == 60 && buffer[i + 1] == 115) {
                        for (l4 = 5; buffer[l4 + 1] != 34; l4++);
                        idx_surah_name_end = l4 + 1;
                        i = l4 + 6;
                        l4 = i;
                        for (num_ayat = 0; buffer[l4] != 34; num_ayat += buffer[l4++] - 48) {
                            num_ayat *= 10;
                        }

                        i = l4 + 2;
                        continue;
                    }
                }
                if (!arabic && buffer[i] == 60 && buffer[i + 1] == 114 && (translation_type == 0 || translation_type == 2)) {
                    arabic = true;
                    latin = false;
                    charw = CHAR_WIDTH[32];
                    line++;
                    k1 = i += 3;
                    if (line > 1) {
                        k1 = ++i;
                    }
                    if (line_on_page[line] == 0) {
                        line_on_page[line] = (short) page;
                    }
                }
                if (!latin && buffer[i] == 60 && buffer[i + 1] == 97 && (translation_type == 0 || translation_type == 1)) {
                    latin = true;
                    arabic = false;
                    charw = CHAR_WIDTH[32];
                    if (translation_type == 1) {
                        line++;
                    }
                    l4 = i + 5;
                    do {
                        if (l4 >= i + 8) {
                            break;
                        }
                        if (buffer[l4 + 1] == 62) {
                            i = l4 + 1;
                            break;
                        }
                        l4++;
                    } while (true);
                    if (translation_type == 1 && line_on_page[line] == 0) {
                        line_on_page[line] = (short) page;
                    }
                    k1 = i + 1;
                    i++;
                }
                l4 = getByte(buffer[i]);
                if (arabic) {
                    if (l4 == 32 && charw <= k2) {
                        surahLength = i;
                        j3 = i3;
                    }
                } else if (latin && (l4 == 32 || l4 == 10 || l4 == 40 || l4 == 41 || l4 == 45 || l4 == 44 || l4 == 33 || l4 == 59 || l4 == 34 || l4 == 58 || l4 == 46) && charw <= k2) {
                    surahLength = i;
                    j3 = i3;
                }
                if ((latin || arabic) && charw >= k2 && j3 != 0) {
                    if (buffer[k1] == 10 || buffer[k1] == 32) {
                        k1++;
                    }
                    page++;
                    buffer_int_au[page] = k1 << 10 | surahLength - k1;
                    ayat_line[page] = (short) line;
                    buffer_short_M[page] = (short) part;
                    if (arabic) {
                        lines_type[page] = '\001';
                    } else {
                        lines_type[page] = '\002';
                    }
                    if (translation_type == 2) {
                        sumLineHeight += 28;
                        lineHeight = 28;
                    } else if (translation_type == 0) {
                        if (latin) {
                            lineHeight = font_height + 2;
                            sumLineHeight += font_height + 2;
                        } else if (arabic) {
                            lineHeight = 28;
                            sumLineHeight += 28;
                        }
                    } else if (translation_type == 1) {
                        lineHeight = font_height + 2;
                        sumLineHeight += font_height + 2;
                    }
                    if (sumLineHeight + lineHeight >= height - top - fontbold_height - 5) {
                        i2++;
                        page_line_start[i2] = (short) page;
                        sumLineHeight = 2;
                    }
                    j5 = 0;
                    charw = CHAR_WIDTH[32];
                    i5 = 0;
                    for (j5 = j3; j5 < i3; j5++) {
                        if (latin) {
                            ac1[i5] = ac1[j5];
                            if (ac1[j5] >= 0 && ac1[j5] <= '~') {
                                charw += CHAR_WIDTH[ac1[j5]];
                            }
                        } else if (arabic) {
                            if (ai1[j5] != 35) {
                                ai1[i5] = ai1[j5];
                            }
                            if (ai1[j5] < 240 && ai1[j5] != 35) {
                                if (ai1[j5] == 38) {
                                    charw += 6;
                                } else {
                                    charw += charWidth(ai1[j5]);
                                }
                            }
                        }
                        i5++;
                    }

                    i3 = i5;
                    if (surahLength < k1) {
                        surahLength = k1;
                    }
                    if (i3 == 0) {
                        k1 = surahLength;
                    } else if (i3 == 1 && ac1[0] == '\n' && latin) {
                        i3 = 0;
                        k1 = surahLength + 1;
                    } else if (i3 == 1 && ac1[0] == '\001' && arabic) {
                        i3 = 0;
                        k1 = surahLength + 1;
                    } else {
                        k1 = surahLength;
                    }
                    if (arabic) {
                        if (l4 == 32) {
                            surahLength = i;
                        }
                    } else if (latin && (l4 == 32 || l4 == 10 || l4 == 40 || l4 == 41 || l4 == 45 || l4 == 44 || l4 == 33 || l4 == 59 || l4 == 34 || l4 == 58 || l4 == 46)) {
                        surahLength = i;
                    }
                }
                if ((latin || arabic) && getByte(buffer[i]) == 10) {
                    if (getByte(buffer[k1]) == 10 || getByte(buffer[k1]) == 32) {
                        k1++;
                    }
                    if (i3 > 1) {
                        page++;
                        buffer_int_au[page] = k1 << 10 | i - k1;
                        ayat_line[page] = (short) line;
                        buffer_short_M[page] = (short) part;
                        if (arabic) {
                            lines_type[page] = '\001';
                        } else {
                            lines_type[page] = '\002';
                        }
                    }
                    i3 = 0;
                    charw = CHAR_WIDTH[32];
                    if (translation_type == 2) {
                        if (line != num_ayat) {
                            sumLineHeight += 28;
                            lineHeight = 28;
                        }
                    } else if (translation_type == 0) {
                        if (latin) {
                            if (line != num_ayat) {
                                lineHeight = font_height + 2;
                                sumLineHeight += font_height + 2;
                                lineHeight += 4;
                                sumLineHeight += 4;
                            }
                        } else if (arabic) {
                            lineHeight = 28;
                            sumLineHeight += 28;
                            lineHeight += 2;
                            sumLineHeight += 2;
                        }
                    } else if (translation_type == 1 && line != num_ayat) {
                        lineHeight = font_height + 2;
                        sumLineHeight += font_height + 2;
                    }
                    if (sumLineHeight + lineHeight >= height - top - fontbold_height - 5) {
                        i2++;
                        page_line_start[i2] = (short) page;
                        sumLineHeight = 2;
                    }
                    latin = false;
                    arabic = false;
                } else if (getByte(buffer[i]) == 10) {
                    i3 = 0;
                    charw = CHAR_WIDTH[32];
                    latin = false;
                    arabic = false;
                }
                if (l4 >= 0 && l4 <= 126 && latin) {
                    ac1[i3++] = (char) l4;
                    charw += CHAR_WIDTH[l4];
                    continue;
                }
                if (!arabic) {
                    continue;
                }
                if (l4 != 35) {
                    ai1[i3++] = l4;
                }
                if (l4 >= 240) {
                    continue;
                }
                if (l4 == 38) {
                    charw += 6;
                    continue;
                }
                if (l4 != 35) {
                    charw += charWidth(l4);
                }
            }

            page_line_start[i2 + 1] = (short) (page + 1);
            buffer_short_M[page] = (short) part;
            if (++part > PART_SURAH[selected_surah - 1]) {
                break;
            }
            page++;
            buffer_short_M[page] = (short) part;
            arabic = false;
            latin = false;
            //loadBin(part);
            loadBin(pilihSurat);
        } while (buffer_len != 0);
        if (PART_SURAH[selected_surah - 1] != 1) {
            loadBin(1);
        }
        l4 = 0;
        i5 = 0;
        j5 = 0;
        ac2 = new char[k2 - CHAR_WIDTH[65]];
        ac2[0] = ' ';
        ac2[1] = '(';
        l4 = CHAR_WIDTH[32] + CHAR_WIDTH[40] + CHAR_WIDTH[41];
        surahLength = SURAH[selected_surah - 1].length();
        try {
            byte abyte0[] = SURAH[selected_surah - 1].getBytes("UTF-8");
            for (part = 0; part < surahLength; part++) {
                j5 += CHAR_WIDTH[abyte0[part]];
            }

        } catch (Exception exception2) {
            j5 = surahLength + 10;
        }
        part = 2;
        charw = 6;
        do {
            if (charw >= idx_surah_name_end) {
                break;
            }
            i5 = buffer[charw] & 0xff;
            if (i5 == 34) {
                break;
            }
            l4 += CHAR_WIDTH[i5];
            ac2[part] = (char) i5;
            if (part + 2 > k2 - CHAR_WIDTH[65] || i5 == 34) {
                break;
            }
            part++;
            charw++;
        } while (true);
        ac2[part] = ')';
        if (l4 + j5 + 5 <= k2 - CHAR_WIDTH[65]) {
            cur_surah = selected_surah + ". " + SURAH[selected_surah - 1] + new String(ac2, 0, part + 1);
        } else {
            cur_surah = selected_surah + "." + new String(ac2, 0, part + 1);
        }
        num_pages = i2;
    }

    public static Image createArabicChar(short word0) {
        if (word0 < 160) {
            return null;
        }
        int ai1[] = new int[128];
        int i1 = word0 - 160 << 4;
        int j1 = word0 >= 240 ? 0xff04049b : 0xff04049b;
        for (int k1 = 1; k1 < 16; k1++) {
            short word2 = PATTERN[i1 + k1];
            for (int i2 = 7; i2 >= 0; i2--) {
                ai1[i2 + (k1 - 1) * 8] = (word2 & 1) != 1 ? 0 : j1;
                word2 >>= 1;
            }

        }

        short word1 = PATTERN[i1];
        for (int l1 = 7; l1 >= 0; l1--) {
            ai1[l1 + 120] = (word1 & 1) != 1 ? 0 : j1;
            word1 >>= 1;
        }

        return Image.createRGBImage(ai1, 8, 16, true);
    }

    public void drawArabic(Graphics g1, int x, int y, short word) {
        try {
            if (word == 38) {
                g1.drawImage(img_sajda, x - 7, y + 2, 20);
                return;
            }
        } catch (Exception exception) {
            return;
        }
        if (word == 35) {
            return;
        }
        if (word < 160) {
            return;
        } else {
            g1.drawImage(ARABIC_CHARACTERS[word - 160], x - 7, y, 20);
            return;
        }
    }

    public short a(int idx, boolean aflag[]) {
        short char_ = (short) getByte(buffer[idx]);
        if (aflag != null) {
            aflag[0] = false;
        }
        if (char_ < 160) {
            return char_;
        }
        short word1 = 0;
        int j1;
        for (j1 = idx - 1; j1 >= 0 && getByte(buffer[j1]) >= 240; j1--);
        if (j1 == 0 || j1 >= 1 && buffer[j1 - 1] != 1 && buffer[j1 - 1] != 2) {
            word1 = (short) getByte(buffer[j1]);
        } else if ((buffer[j1 - 1] == 1 || buffer[j1 - 1] == 2) && j1 > 2 && buffer[j1 - 2] <= 2) {
            word1 = (short) getByte(buffer[j1]);
        }
        short word2 = 0;
        for (j1 = idx + 1; getByte(buffer[j1]) >= 240; j1++);
        word2 = (short) getByte(buffer[j1]);
        if (p > 0) {
            if (char_ >= 240) {
                short word3 = char_;
                char_ = p;
                p = word3;
            } else {
                char_ = p;
                p = 0;
            }
            word1 = 0;
        }
        if (char_ >= 240) {
            if (word1 == 220 && (word2 == 175 || word2 == 165 || word2 == 167 || word2 == 170)) {
                return char_;
            }
            if (aflag != null && char_ != 240 && word2 >= 160 && word1 >= 160 && C[word2 - 160] != 0 && D[word1 - 160] != 0) {
                aflag[0] = true;
            }
            return char_;
        }
        if (char_ == 220 && (word2 == 175 || word2 == 165 || word2 == 167 || word2 == 170)) {
            char_ = 238;
        } else if (word1 == 220) {
            if (char_ == 175) {
                return 237;
            }
            if (char_ == 165) {
                return 234;
            }
            if (char_ == 167) {
                return 235;
            }
            if (char_ == 170) {
                return 236;
            }
        }
        short word4;
        if (word2 >= 160 && C[word2 - 160] != 0 && (word4 = A[0][char_ - 160]) != 0) {
            char_ = word4;
            if (aflag != null) {
                aflag[0] = true;
            }
        }
        if (word1 >= 160 && D[word1 - 160] != 0 && (word4 = A[1][char_ - 160]) != 0) {
            char_ = word4;
        }
        return char_;
    }

    public static int getByte(byte byte0) {
        return byte0 & 0xff;
    }

    public static int charWidth(int i1) {
        return (byte) (i1 > 2 && i1 < 240 ? 8 : 0);
    }

    public void drawLineArabic(Graphics g, byte bData[], int len, int y) {
        int x = width - bar_size - 3;
        if (len < 0) {
            return;
        }
        try {
            for (int i = 0; i <= len; i++) {
                short arabicData = (short) getByte(bData[i]);
                if (arabicData != 35) {
                    if (arabicData >= 240) {
                        if (arabicData == 248 || arabicData == 243) {
                            drawArabic(g, x + 6, y + 4, arabicData);
                        } else if (arabicData == 250) {
                            drawArabic(g, x + 9, y - 3, arabicData);
                        } else if (i > 0 && arabicData != 240 && getByte(bData[i - 1]) == 250) {
                            drawArabic(g, x + 5, y - 6, arabicData);
                        } else if (arabicData == 246) {
                            drawArabic(g, x + 6, y - 5, arabicData);
                        } else {
                            drawArabic(g, x + 6, y - 4, arabicData);
                        }
                    } else {
                        drawArabic(g, x, y, arabicData);
                        x -= charWidth(arabicData);
                    }
                }
            }

        } catch (Exception exception) {
        }
    }

    public static void saveToRS(String rsname, byte b[], int len) {
        try {
            RecordStore.deleteRecordStore(rsname);
        } catch (RecordStoreNotFoundException e) {
        } catch (RecordStoreException e) {
        }
        try {
            RecordStore rs = RecordStore.openRecordStore(rsname, true);
            rs.addRecord(b, 0, len);
            rs.closeRecordStore();
        } catch (RecordStoreFullException e) {
            e.printStackTrace();
        } catch (RecordStoreNotFoundException e) {
            e.printStackTrace();
        } catch (RecordStoreException e) {
            e.printStackTrace();
        }
    }

    protected void hideNotify() {
        paint_flag = 3;
//        if (menuBar.shown) {
//            paint_flag |= 4;
//        } else if (messageBox != null) {
//            paint_flag |= 8;
//        }
    }

    public String replaceAll(String text, String searchString, String replacementString) {
        StringBuffer sBuffer = new StringBuffer();
        for (int pos = 0; (pos = text.indexOf(searchString)) != -1;) {
            sBuffer.append(text.substring(0, pos) + replacementString);
            text = text.substring(pos + searchString.length());
        }

        sBuffer.append(text);
        return sBuffer.toString();
    }
    public static final int PAINT_CENTER = 1;
    public static final int PAINT_ALL = 3;
    public static final int PAINT_MENUBAR = 2;
    public static final int PAINT_MENU = 4;
    public static final int PAINT_MSGBOX = 8;
    public Display display;
    public Quran midlet;
    Drawer drawer;
    public int width_286;
    public int selected_surah;
    public int show_surah;
    public static String cur_surah;
    public static int page;
    public static int num_pages;
    public static int cur_page;
    public int center_top;
    public int center_height;
    public int lines;
    public int left_286;
    public int H;
    public static char lines_type[] = new char[11800];
    public static int buffer_int_au[] = new int[11800];
    public static short page_line_start[] = new short[4000];
    public static byte buffer[];
    public static short ayat_line[] = new short[11800];
    public static short line_on_page[] = new short[300];
    public static int num_ayat;
    public static int buffer_len;
    public Form form_help;
    private Form form_search;
    private TextField textField;
    public int num_lines_index;
    public int x_column_number1;
    public int x_column_number2;
    public int cur_lines_index;
    public int headerHeight;
    public int center2_height;
    int lines2;
    private int x_column_1;
    private int x_column_2;
//    public Image img_selector;
    public Image img_sajda;
//    public Image img_idx;
    public Image img_surah;
    public int xSelector;
    public int ySelector;
    public int title_width;
    public int column;
    Class classobj;
    public static boolean dirty;
    boolean is_in_index;
    public ScrollBar scrollbar;
    public int bar_size;
    public int width;
    public int height;
    public int margin_top;
    public int top_c;
    public static int fontbold_height;
    public static int FONTBOLD_HEIGHT;
    public int top;
    int translation_type;
    public static Font font;
    static Font fontBold;
    public static int font_height;
    public static short CHAR_WIDTH[] = new short[127];
    private final Command cmd_verse_ok = new Command("Ok", 4, 2);
    private final Command cmd_ok_search = new Command("OK", 4, 1);
    private final Command cmd_cancel = new Command("Kembali", 3, 3);
    public TextField textfield;
    public static int max_buffer_size;
    public int bar_width;
    public int bar_progress;
    public static String SURAH[] = {
        "Yasin"
    };
    public int cur_index;
    public static short PART_SURAH[] = {
        1
    };
    public static short buffer_short_M[] = new short[11800];
    public static Image ARABIC_CHARACTERS[] = new Image[95];
    public byte buffer_line_arabic[];
    public short p;
    String playing_stats;
    int paint_flag;
    public MessageBox messageBox;
    public static short PATTERN[] = {
        0, 0, 0, 0, 0, 8, 0, 0, 2, 3,
        65, 65, 97, 126, 60, 0, 0, 0, 0, 0,
        0, 0, 0, 4, 8, 16, 28, 24, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 4, 8, 16,
        28, 24, 0, 24, 0, 0, 0, 0, 0, 0,
        0, 124, 198, 192, 96, 48, 48, 0, 48, 48,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 28, 54, 48, 30, 56, 0, 0, 0, 0,
        0, 0, 60, 64, 8, 24, 24, 24, 24, 24,
        24, 24, 16, 0, 0, 0, 0, 0, 60, 64,
        8, 24, 24, 24, 24, 24, 31, 15, 0, 0,
        0, 0, 0, 8, 16, 24, 16, 8, 24, 24,
        24, 24, 24, 24, 16, 0, 0, 0, 0, 8,
        16, 24, 16, 8, 24, 24, 24, 24, 31, 15,
        0, 0, 0, 0, 0, 0, 0, 4, 8, 12,
        8, 2, 5, 9, 15, 7, 1, 6, 124, 56,
        0, 0, 0, 8, 24, 24, 24, 24, 24, 24,
        24, 16, 8, 16, 24, 16, 0, 0, 0, 8,
        24, 24, 24, 24, 24, 24, 31, 15, 16, 32,
        48, 32, 0, 0, 0, 0, 16, 32, 48, 34,
        3, 1, 255, 254, 0, 0, 0, 0, 0, 0,
        0, 0, 64, 128, 195, 135, 8, 16, 158, 130,
        194, 252, 120, 0, 0, 0, 0, 0, 0, 16,
        32, 48, 32, 0, 67, 131, 193, 255, 126, 0,
        0, 0, 0, 8, 24, 24, 24, 24, 24, 24,
        24, 24, 16, 0, 0, 0, 0, 0, 0, 8,
        24, 24, 24, 24, 24, 24, 31, 15, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
        3, 1, 255, 254, 0, 0, 8, 0, 0, 0,
        0, 0, 0, 0, 0, 66, 131, 129, 255, 126,
        0, 0, 8, 0, 0, 0, 0, 5, 0, 0,
        6, 7, 9, 9, 15, 14, 0, 0, 0, 0,
        0, 0, 0, 0, 36, 0, 0, 2, 3, 1,
        255, 254, 0, 0, 0, 0, 0, 0, 0, 0,
        36, 0, 0, 66, 131, 129, 255, 126, 0, 0,
        0, 0, 0, 0, 0, 16, 0, 40, 0, 2,
        3, 1, 255, 254, 0, 0, 0, 0, 0, 0,
        0, 8, 0, 20, 0, 66, 131, 129, 255, 126,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 24, 44, 6, 255, 254, 0, 0, 8, 0,
        0, 0, 0, 0, 0, 0, 0, 48, 76, 31,
        35, 64, 72, 96, 127, 62, 0, 0, 0, 0,
        0, 0, 0, 24, 44, 6, 255, 254, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 48,
        76, 31, 35, 64, 64, 96, 127, 62, 0, 0,
        0, 0, 16, 0, 0, 24, 44, 6, 255, 254,
        0, 0, 0, 0, 0, 0, 0, 0, 8, 0,
        0, 48, 76, 31, 35, 64, 64, 96, 127, 62,
        0, 0, 0, 0, 0, 0, 4, 6, 3, 33,
        63, 30, 0, 0, 0, 0, 0, 0, 0, 0,
        16, 0, 4, 6, 3, 33, 63, 30, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        2, 3, 1, 1, 1, 6, 124, 56, 0, 0,
        0, 0, 0, 4, 0, 0, 2, 3, 1, 1,
        1, 6, 124, 56, 0, 0, 0, 0, 0, 0,
        0, 0, 1, 37, 255, 218, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 1, 37,
        191, 154, 144, 144, 240, 96, 0, 0, 0, 0,
        4, 0, 10, 0, 1, 37, 255, 218, 0, 0,
        0, 0, 0, 0, 0, 0, 4, 0, 10, 0,
        1, 37, 191, 154, 144, 144, 240, 96, 0, 0,
        0, 0, 0, 0, 0, 6, 41, 49, 255, 222,
        16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 6, 9, 49, 191, 158, 144, 144, 240, 96,
        0, 0, 0, 0, 4, 0, 0, 6, 41, 49,
        255, 222, 16, 0, 0, 0, 0, 0, 0, 0,
        4, 0, 0, 6, 9, 49, 191, 158, 144, 144,
        240, 96, 0, 0, 0, 32, 48, 32, 32, 38,
        41, 49, 255, 254, 0, 0, 0, 0, 0, 0,
        0, 32, 50, 32, 32, 38, 41, 49, 255, 254,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        28, 34, 48, 24, 254, 252, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 28, 32, 32, 30, 28,
        32, 64, 64, 96, 127, 62, 0, 0, 0, 0,
        0, 0, 0, 14, 31, 14, 255, 251, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 28,
        62, 28, 39, 67, 64, 96, 127, 62, 0, 0,
        0, 16, 0, 0, 28, 34, 48, 24, 254, 252,
        0, 0, 0, 0, 0, 0, 16, 0, 0, 28,
        32, 32, 30, 28, 32, 64, 64, 96, 127, 62,
        0, 0, 0, 0, 4, 0, 0, 14, 31, 14,
        255, 251, 0, 0, 0, 0, 0, 0, 0, 0,
        8, 0, 0, 28, 62, 28, 39, 67, 64, 96,
        127, 62, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 255, 255, 0, 0, 0, 0, 0, 0,
        2, 0, 0, 2, 5, 9, 15, 1, 255, 254,
        0, 0, 0, 0, 0, 0, 2, 0, 0, 2,
        5, 73, 143, 129, 255, 126, 0, 0, 0, 0,
        0, 0, 9, 0, 0, 2, 5, 9, 15, 1,
        255, 254, 0, 0, 0, 0, 0, 0, 0, 0,
        9, 0, 0, 2, 5, 9, 79, 71, 97, 126,
        60, 0, 0, 0, 0, 1, 6, 24, 48, 24,
        6, 1, 255, 254, 0, 0, 0, 0, 0, 0,
        0, 1, 3, 11, 19, 91, 147, 131, 255, 126,
        0, 0, 0, 0, 0, 0, 0, 1, 3, 3,
        3, 3, 3, 3, 255, 254, 0, 0, 0, 0,
        0, 0, 0, 1, 3, 3, 3, 3, 3, 3,
        67, 67, 99, 126, 60, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 6, 11, 249, 253, 6, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        6, 59, 121, 109, 102, 96, 96, 64, 0, 0,
        0, 0, 8, 0, 0, 2, 3, 1, 255, 254,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
        0, 0, 2, 3, 65, 65, 97, 126, 60, 0,
        0, 0, 0, 0, 0, 0, 56, 28, 38, 25,
        255, 238, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 6, 7, 9, 9, 15, 14, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 2, 6,
        10, 20, 255, 255, 18, 14, 6, 0, 0, 0,
        0, 0, 0, 0, 0, 2, 5, 9, 15, 7,
        1, 6, 124, 56, 0, 0, 0, 0, 0, 0,
        3, 7, 8, 16, 158, 130, 194, 252, 120, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        67, 131, 193, 255, 126, 0, 0, 0, 0, 0,
        0, 0, 0, 2, 3, 1, 255, 254, 0, 0,
        36, 0, 72, 0, 0, 0, 0, 0, 3, 7,
        8, 16, 158, 130, 194, 252, 120, 0, 72, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 67, 131,
        193, 255, 126, 0, 0, 0, 0, 0, 15, 16,
        3, 3, 0, 0, 0, 1, 3, 0, 0, 0,
        0, 0, 0, 0, 16, 34, 51, 35, 0, 0,
        0, 1, 3, 0, 0, 0, 0, 0, 0, 0,
        0, 2, 3, 3, 0, 0, 0, 1, 19, 32,
        48, 32, 0, 0, 0, 0, 0, 2, 3, 3,
        0, 0, 0, 1, 3, 0, 0, 0, 0, 0,
        0, 8, 12, 12, 8, 136, 200, 88, 48, 200,
        240, 0, 0, 0, 0, 0, 0, 8, 24, 24,
        24, 152, 216, 124, 55, 227, 192, 0, 0, 0,
        0, 0, 18, 36, 72, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 18, 36,
        72, 0, 0, 0, 0, 0, 255, 255, 0, 0,
        0, 0, 0, 0, 102, 170, 238, 68, 136, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 18, 36, 72, 0, 0, 2, 4, 8, 16,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 2, 4, 8, 16, 0, 0, 0, 0,
        255, 255, 0, 0, 0, 0, 0, 0, 6, 10,
        14, 4, 8, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 6, 10, 14, 4, 8, 0,
        0, 0, 255, 255, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        2, 4, 8, 16, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 255, 255, 0, 4, 8, 16,
        0, 0, 2, 74, 52, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 2, 74,
        52, 0, 0, 0, 0, 0, 255, 255, 0, 0,
        0, 0, 0, 0, 6, 10, 12, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        6, 10, 12, 0, 0, 0, 0, 0, 255, 255,
        0, 0, 0, 0, 0, 0, 0, 8, 16, 24,
        22, 7, 9, 9, 15, 14, 0, 0, 0, 0,
        0, 0, 18, 36, 72, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    public static byte D[] = {
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 1, 0, 0, 1, 1, 0,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
        1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 1, 0, 1, 0, 1,
        0, 1, 0, 1, 0, 0
    };
    public static byte C[] = {
        1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 0, 0, 0, 0, 1, 1,
        0, 1, 0, 0, 0, 1, 0, 1, 0, 1,
        0, 1, 0, 1, 0, 0
    };
    public static short A[][] = {
        {
            223, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 172, 172, 0, 0, 0, 177, 0,
            0, 180, 0, 182, 0, 184, 0, 186, 0, 188,
            0, 0, 0, 0, 0, 194, 0, 196, 0, 198,
            0, 200, 0, 0, 0, 204, 0, 206, 0, 208,
            0, 210, 0, 0, 213, 0, 215, 0, 217, 0,
            219, 0, 221, 0, 223, 0, 225, 0, 0, 231,
            231, 0, 231, 231, 0, 0, 0, 0, 0, 0,
            241, 241, 242, 243, 245, 245, 247, 247, 249, 249,
            251, 251, 253, 253, 0, 241
        }, {
            0, 0, 0, 0, 0, 166, 0, 168, 0, 0,
            171, 0, 0, 174, 0, 176, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 206, 207, 0, 0, 210, 211,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 227, 0, 0, 0, 230,
            0, 0, 233, 0, 0, 0, 0, 0, 239, 0,
            241, 241, 242, 243, 245, 245, 247, 247, 249, 249,
            251, 251, 253, 253, 0, 241
        }
    };
   
}
